﻿using Microsoft.UI.Xaml.Markup;

namespace DimensionsHelper.Client.WinUi.Extensions;

public partial class FontIconExtension : MarkupExtension
{
    public string? Glyph { get; set; }


    public int FontSize
    {
        get;
        set;
    }


    public Brush? Foreground
    {
        get;
        set;
    }


    protected override object ProvideValue()
    {
        FontIcon fontIcon = new()
        {
            FontFamily = FontHelper.FluentUiSystemFont,
            Glyph = Glyph
        };

        if (FontSize > 0)
        {
            fontIcon.FontSize = FontSize;
        }

        if (Foreground != null)
        {
            fontIcon.Foreground = Foreground;
        }

        return fontIcon;
    }
}